#ifndef GRAPHIC_DATA_MODEL_H
#define GRAPHIC_DATA_MODEL_H

#include "../../graphs/directedgraph.h"

#include <QtCore/QHash>
#include <QtCore/QUuid>

namespace core
{
class ConnectionData;
class GDModelQueryMaker;
class IGraphicEditorItem;

class GraphicDataModel
{
public:
    GraphicDataModel();
    virtual ~GraphicDataModel();

    void addModelItem(IGraphicEditorItem* item);
    void removeModelItem(IGraphicEditorItem* item);

    void addModelConnection(const ConnectionData& data);
    void removeModelConnection(const ConnectionData& data);

    bool hasItem(QUuid id) const;
    Node* getNode(IGraphicEditorItem* item) const;
    const DirectedGraph* graphRepresentation() const;

    void clearModel();

protected:
    QList<ConnectionData> m_allConnections;
    QHash<int, QHash<QString, QList<IGraphicEditorItem* > > >
        m_categorizedItems;
    QHash<QUuid, IGraphicEditorItem* > m_items;
    QHash<IGraphicEditorItem*, Node* > m_nodes;
    DirectedGraph m_graph;

    friend class GDModelQueryMaker;
};

} // namespace core

#endif
